<script setup lang="ts">
import { onMounted } from 'vue';

import TagTreeSelect from './tree-select.vue';

const emit = defineEmits(['change']);
const modelValue = defineModel<(number | string)[]>('value', {
  default: () => [],
});

function onChange(value) {
  emit('change', value);
}

onMounted(() => {
  if (modelValue.value === null) {
    modelValue.value = [];
  }
});
</script>

<template>
  <TagTreeSelect v-model:value="modelValue" :tag-type="1" @change="onChange" />
</template>
